<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>比较两个日期是否相同</title>
</head>
<body>
  <script>
    // 设置一个日期
    const date1 = new Date('2023/4/1')
    // 获取当前日期
    const date2 = new Date()
    const weekDay = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
    const time1 = date1.getDay()
    const time2 = date2.getDay()
    // console.log(weekDay[time1], weekDay[time2])
    if(time1 == time2) {
      alert('相同')
    } else {
      alert('不相同')
    }
  </script>
</body>
</html>